package com.sywb.chuangyebao.view;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.sywb.chuangyebao.R;
import com.sywb.chuangyebao.bean.WxInfo;
import com.sywb.chuangyebao.utils.GlideUtils;
import com.sywb.chuangyebao.utils.HttpCallback;
import com.sywb.chuangyebao.utils.HttpUtils;

import butterknife.BindView;

/**
 * 3158创业宝官方微信
 */
public class UserWeiXinActivity extends ActionbarActivity {

    @BindView(R.id.tv_dis)
    TextView tvDis;
    @BindView(R.id.iv_qrcode)
    ImageView ivQrcode;
    @BindView(R.id.tv_name)
    TextView tvName;

    @Override
    public int getLayoutId(Bundle bundle) {
        return R.layout.activity_user_weixin;
    }

    @Override
    public void initView(Bundle bundle) {
        super.initView(bundle);
        setTitle(R.string.about_us);

        HttpUtils.getWx(new HttpCallback<WxInfo>() {

            @Override
            public void onStart() {
                super.onStart();
                showProgress();
            }

            @Override
            public void onFinish() {
                super.onFinish();
                hideProgress();
            }

            @Override
            public void onSuccess(WxInfo wxInfo) {
                if (wxInfo == null) {
                    return;
                }

                tvDis.setText(wxInfo.dis);
                tvName.setText(wxInfo.name);
                GlideUtils.getNormalIamgeToUrl(mActivity, wxInfo.pic, ivQrcode);
            }
        });
    }

}
